/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

import request from '@/utils/request';
import isArray from 'lodash/isArray';

export async function getFeedbackList(params: {
  page?: string | number;
  pageSize?: string | number;
  status: 0 | 1 | 2;
}) {
  return request('/FilePrintConsumer/feedbackList', {
    method: 'POST',
    data: params,
  }).then(({ data }: any) => {
    const { list, total } = data;
    if (isArray(list) && list.length > 0) {
      return {
        total,
        success: true,
        data: list,
        current: params.page || 1,
      };
    }
    return {};
  });
}

export async function setFeedback(params: {
  id: string;
  reply_type: 1 | 2; //1 已处理 2 已忽略
  reply?: string;
  reply_images?: string[];
}) {
  return request('/FilePrintConsumer/addReplyFeedback', {
    method: 'POST',
    data: params,
  });
}
